package com.hk.web.domain.lifeCycle;

import com.hk.web.domain.entity.AuthMenuItem;
import com.hk.web.dto.AuthMenuItemDTO;

/**
 * Created by Antinomy on 17/7/26.
 */
public class AuthMenuItemFactory {

    public static AuthMenuItem createFromDTO(AuthMenuItemDTO dto) {
        AuthMenuItem result = new AuthMenuItem();

        result.setParentId(dto.getParentId());
        result.setUniqueId(dto.getUniqueId());
        result.setLabel(dto.getLabel());
        result.setRouter(dto.getRouter());
        result.setMenuType(dto.getMenuType());
        result.setIcon(dto.getIcon());

        return result;
    }

    public static AuthMenuItemDTO createFromEntity(AuthMenuItem dto) {
        AuthMenuItemDTO result = new AuthMenuItemDTO();

        result.setId(dto.getId());
        result.setParentId(dto.getParentId());
        result.setUniqueId(dto.getUniqueId());
        result.setLabel(dto.getLabel());
        result.setRouter(dto.getRouter());
        result.setMenuType(dto.getMenuType());
        result.setIcon(dto.getIcon());

        return result;
    }
}
